package com.dc.web.controller;

import com.dc.dao.DepartmentDao;
import com.dc.entity.DepartmentEntity;
import com.dc.model.AjaxResult;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "部门")
@RestController
@RequestMapping("/api/department")
@Slf4j
public class DepartmentController {

    @Resource
    DepartmentDao departmentDao;

    @GetMapping("/list")
    public AjaxResult list() {
        List<DepartmentEntity> all = departmentDao.findAll();
        return AjaxResult.success(all);
    }
}
